import time

from data013.Page.Page import Page
from selenium.webdriver.common.by import By

class Page2(Page):
    #
    iframe_loc = (By.XPATH, '/html/body/div[3]/div[3]/div[1]/div/div[3]/div[1]/div[2]/iframe')
    def iframe(self):
        self.frame(self.iframe_loc)
    # 账号
    email_loc = (By.XPATH, '/html/body/div[2]/div[2]/div[2]/form/div/div[1]/div[2]/input')
    def email(self):
        self.send_keys(self.email_loc, 'gw17518836160')
    # 密码
    password_loc = (By.XPATH, '/html/body/div[2]/div[2]/div[2]/form/div/div[3]/div[2]/input[2]')
    def password(self):
        self.send_keys(self.password_loc, 'GeWei17518836160')
    # 点击登录
    dologin_loc = (By.ID, 'dologin')
    def dologin(self):
        self.click(self.dologin_loc)
    # 点击写信 /html/body/div[1]/nav/div[1]/ul/li[2]/span[2]
    span_loc = (By.XPATH,'/html/body/div[1]/nav/div[1]/ul/li[2]/span[2]')
    def span(self):
        self.click(self.span_loc)
    # 输入收件人
    ipt_loc = (By.XPATH,'/html/body/div[2]/div[1]/div[2]/div[1]/section/header/div[1]/div[1]/div/div[2]/div/input')
    def ipt(self):
        self.send_keys(self.ipt_loc,'gw17518836160@126.com')
    # 输入主题  /html/body/div[2]/div[1]/div[2]/div[1]/section/header/div[2]/div[1]/div/div/input
    sjr_loc = (By.XPATH,'/html/body/div[2]/div[1]/div[2]/div[1]/section/header/div[2]/div[1]/div/div/input')
    def sjr(self):
        self.send_keys(self.sjr_loc,'你好')
    # 进入框架 APP-editor-iframe
    iframe_loc1 = (By.CLASS_NAME,'APP-editor-iframe')
    def iframe1(self):
        self.frame(self.iframe_loc1)
    # 输入附件 /html/body/div
    fujian_loc = (By.XPATH,'/html/body/div')
    def fujian(self):
        self.send_keys(self.fujian_loc,'6666666666666666666')
    # 点击发送  /html/body/div[2]/div[1]/div[2]/header/div/div[1]/div/span[2]
    fashong_loc = (By.XPATH,'/html/body/div[2]/div[1]/div[2]/header/div/div[1]/div/span[1]/b')
    def fashong(self):
        self.click(self.fashong_loc)

    def test_126_xiexin(self):
        self.open_url('https://126.com/')
        self.iframe()
        self.email()
        self.password()
        self.dologin()
        self.content()
        time.sleep(5)
        # self.test_126_login()
        self.handles()
        time.sleep(3)
        self.span()
        time.sleep(1)
        self.ipt()
        time.sleep(1)
        self.sjr()
        self.iframe1()
        self.fujian()
        time.sleep(1)
        self.content()
        self.fashong()
        time.sleep(5)



